<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @author David Gossow - dgossow@willowgarage.com
<span class='line'>  3</span>  */</span><span class="WHIT">
<span class='line'>  4</span> 
<span class='line'>  5</span> </span><span class="COMM">/**
<span class='line'>  6</span>  * Handle with signals for a single interactive marker.
<span class='line'>  7</span>  *
<span class='line'>  8</span>  * Emits the following events:
<span class='line'>  9</span>  *  * 'pose' - emitted when a new pose comes from the server
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * @constructor
<span class='line'> 12</span>  * @param options - object with following keys:
<span class='line'> 13</span>  *  * message - the interactive marker message
<span class='line'> 14</span>  *  * feedbackTopic - the ROSLIB.Topic associated with the feedback
<span class='line'> 15</span>  *  * tfClient - a handle to the TF client to use
<span class='line'> 16</span>  */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">  </span><span class="NAME">this.message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.message</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">  </span><span class="NAME">this.feedbackTopic</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.feedbackTopic</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">  </span><span class="NAME">this.tfClient</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.tfClient</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">  </span><span class="NAME">this.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.message.name</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">  </span><span class="NAME">this.header</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.message.header</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">  </span><span class="NAME">this.controls</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.message.controls</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">  </span><span class="NAME">this.menuEntries</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.message.menu_entries</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">  </span><span class="NAME">this.dragging</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">  </span><span class="NAME">this.timeoutHandle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">  </span><span class="NAME">this.tfTransform</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Transform</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">  </span><span class="NAME">this.pose</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Pose</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> 
<span class='line'> 31</span> </span><span class="WHIT">  </span><span class="COMM">// start by setting the pose</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">  </span><span class="NAME">this.setPoseFromServer</span><span class="PUNC">(</span><span class="NAME">this.message.pose</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.__proto__</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">EventEmitter2.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 35</span> 
<span class='line'> 36</span> </span><span class="COMM">/**
<span class='line'> 37</span>  * Subscribe to the TF associated with this interactive marker.
<span class='line'> 38</span>  */</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.subscribeTf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">  </span><span class="COMM">// subscribe to tf updates if frame-fixed</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.message.header.stamp.secs</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0.0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.message.header.stamp.nsecs</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0.0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">    </span><span class="NAME">this.tfClient.subscribe</span><span class="PUNC">(</span><span class="NAME">this.message.header.frame_id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.tfUpdate.bind</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> 
<span class='line'> 46</span> </span><span class="COMM">/**
<span class='line'> 47</span>  * Emit the new pose that has come from the server.
<span class='line'> 48</span>  */</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.emitServerPoseUpdate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">poseTransformed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Pose</span><span class="PUNC">(</span><span class="NAME">this.pose</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">  </span><span class="NAME">poseTransformed.applyTransform</span><span class="PUNC">(</span><span class="NAME">this.tfTransform</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">  </span><span class="NAME">this.emit</span><span class="PUNC">(</span><span class="STRN">'pose'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">poseTransformed</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> 
<span class='line'> 55</span> </span><span class="COMM">/**
<span class='line'> 56</span>  * Update the pose based on the pose given by the server.
<span class='line'> 57</span>  * 
<span class='line'> 58</span>  * @param poseMsg - the pose given by the server
<span class='line'> 59</span>  */</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.setPoseFromServer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">poseMsg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">  </span><span class="NAME">this.pose</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Pose</span><span class="PUNC">(</span><span class="NAME">poseMsg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">  </span><span class="NAME">this.emitServerPoseUpdate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> 
<span class='line'> 65</span> </span><span class="COMM">/**
<span class='line'> 66</span>  * Update the pose based on the TF given by the server.
<span class='line'> 67</span>  * 
<span class='line'> 68</span>  * @param transformMsg - the TF given by the server
<span class='line'> 69</span>  */</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.tfUpdate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">transformMsg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">  </span><span class="NAME">this.tfTransform</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Transform</span><span class="PUNC">(</span><span class="NAME">transformMsg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">  </span><span class="NAME">this.emitServerPoseUpdate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 74</span> 
<span class='line'> 75</span> </span><span class="COMM">/**
<span class='line'> 76</span>  * Set the pose from the client based on the given event.
<span class='line'> 77</span>  * 
<span class='line'> 78</span>  * @param event - the event to base the change off of
<span class='line'> 79</span>  */</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.setPoseFromClient</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">  </span><span class="COMM">// apply the transform</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">  </span><span class="NAME">this.pose</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ROSLIB.Pose</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">inv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.tfTransform.clone</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">  </span><span class="NAME">inv.rotation.invert</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">  </span><span class="NAME">this.pose.applyTransform</span><span class="PUNC">(</span><span class="NAME">inv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> 
<span class='line'> 87</span> </span><span class="WHIT">  </span><span class="COMM">// send feedback to the server</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">  </span><span class="NAME">this.sendFeedback</span><span class="PUNC">(</span><span class="NAME">ROS3D.INTERACTIVE_MARKER_POSE_UPDATE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.controlName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 89</span> 
<span class='line'> 90</span> </span><span class="WHIT">  </span><span class="COMM">// keep sending pose feedback until the mouse goes up</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.dragging</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.timeoutHandle</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">      </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">this.timeoutHandle</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">    </span><span class="NAME">this.timeoutHandle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="NAME">this.setPoseFromClient.bind</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">250</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 98</span> 
<span class='line'> 99</span> </span><span class="COMM">/**
<span class='line'>100</span>  * Send the button click feedback to the server.
<span class='line'>101</span>  * 
<span class='line'>102</span>  * @param event - the event associated with the button click
<span class='line'>103</span>  */</span><span class="WHIT">
<span class='line'>104</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.onButtonClick</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">  </span><span class="NAME">this.sendFeedback</span><span class="PUNC">(</span><span class="NAME">ROS3D.INTERACTIVE_MARKER_BUTTON_CLICK</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.clickPosition</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">      </span><span class="NAME">event.controlName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> 
<span class='line'>109</span> </span><span class="COMM">/**
<span class='line'>110</span>  * Send the mousedown feedback to the server.
<span class='line'>111</span>  * 
<span class='line'>112</span>  * @param event - the event associated with the mousedown
<span class='line'>113</span>  */</span><span class="WHIT">
<span class='line'>114</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.onMouseDown</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">  </span><span class="NAME">this.sendFeedback</span><span class="PUNC">(</span><span class="NAME">ROS3D.INTERACTIVE_MARKER_MOUSE_DOWN</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.clickPosition</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.controlName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">  </span><span class="NAME">this.dragging</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> 
<span class='line'>119</span> </span><span class="COMM">/**
<span class='line'>120</span>  * Send the mouseup feedback to the server.
<span class='line'>121</span>  * 
<span class='line'>122</span>  * @param event - the event associated with the mouseup
<span class='line'>123</span>  */</span><span class="WHIT">
<span class='line'>124</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.onMouseUp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">  </span><span class="NAME">this.sendFeedback</span><span class="PUNC">(</span><span class="NAME">ROS3D.INTERACTIVE_MARKER_MOUSE_UP</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.clickPosition</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.controlName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">  </span><span class="NAME">this.dragging</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.timeoutHandle</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">    </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">this.timeoutHandle</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>130</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>131</span> 
<span class='line'>132</span> </span><span class="COMM">/**
<span class='line'>133</span>  * Send the menu select feedback to the server.
<span class='line'>134</span>  * 
<span class='line'>135</span>  * @param event - the event associated with the menu select
<span class='line'>136</span>  */</span><span class="WHIT">
<span class='line'>137</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.onMenuSelect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">  </span><span class="NAME">this.sendFeedback</span><span class="PUNC">(</span><span class="NAME">ROS3D.INTERACTIVE_MARKER_MENU_SELECT</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event.controlName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>139</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>140</span> 
<span class='line'>141</span> </span><span class="COMM">/**
<span class='line'>142</span>  * Send feedback to the interactive marker server.
<span class='line'>143</span>  * 
<span class='line'>144</span>  * @param eventType - the type of event that happened
<span class='line'>145</span>  * @param clickPosition (optional) - the position in ROS space the click happened
<span class='line'>146</span>  * @param menuEntryID (optional) - the menu entry ID that is associated
<span class='line'>147</span>  * @param controlName - the name of the control
<span class='line'>148</span>  */</span><span class="WHIT">
<span class='line'>149</span> </span><span class="NAME">ROS3D.InteractiveMarkerHandle.prototype.sendFeedback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">eventType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">clickPosition</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">    </span><span class="NAME">menuEntryID</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">controlName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>151</span> 
<span class='line'>152</span> </span><span class="WHIT">  </span><span class="COMM">// check for the click position</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mousePointValid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">clickPosition</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">clickPosition</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">clickPosition</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">    </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">    </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">    </span><span class="NAME">z</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> 
<span class='line'>160</span> </span><span class="WHIT">  </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">feedback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">    </span><span class="NAME">header</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.header</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">    </span><span class="NAME">client_id</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.clientID</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">    </span><span class="NAME">marker_name</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.name</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">    </span><span class="NAME">control_name</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">controlName</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">    </span><span class="NAME">event_type</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">eventType</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">    </span><span class="NAME">pose</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.pose</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">    </span><span class="NAME">mouse_point</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">clickPosition</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">    </span><span class="NAME">mousePointValid</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">mousePointValid</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">    </span><span class="NAME">menuEntryID</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">menuEntryID</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">  </span><span class="NAME">this.feedbackTopic.publish</span><span class="PUNC">(</span><span class="NAME">feedback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>173</span> </span></pre></body></html>